import { req_login } from "../api/registerLogin";


export default {
   async login_a({commit},{user_name,password,routerT}){
        console.log(user_name,password,routerT);
        console.log(req_login);
        let result = await req_login({
            method:"post",
            url:"/login",
            arg:{user_name,password},
            headerType:"form"
        })

        console.log(result);
        console.log(result.data.info);
        if(result.data.info == '登录成功！！'){
            // 登录成功后跳转
            routerT.push({
                name:'home'
            })

        }


        commit ("login",{
            user_name,
            info:result.data.info,
            token:result.data.token
        });
        console.log(commit);
    }
}